package com.maikang.exammall.util.validator;

import com.maikang.exammall.util.idvalidator.IDValidator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class IdentityCardNumberValidator implements ConstraintValidator<IdentityCardNumber, Object> {
    private IDValidator validator = new IDValidator();

    @Override
    public void initialize(IdentityCardNumber identityCardNumber) {
    }

    @Override
    public boolean isValid(Object o, ConstraintValidatorContext constraintValidatorContext) {
        if (o == null) return true;
        return validator.isValid(o.toString());
    }
}
